package p

import (
	"fmt"
	"unsafe"
)

type W struct {
	b byte
	i int32
	j int64
}

func (w *W) PrintSizeInfo() {
	fmt.Printf("sizeof W=%d\n", unsafe.Sizeof(*w))
	fmt.Printf("sizeof(w.b)=%d\n", unsafe.Sizeof(w.b))
	fmt.Printf("sizeof(w.i)=%d\n", unsafe.Sizeof(w.i))
	fmt.Printf("sizeof(w.j)=%d\n", unsafe.Sizeof(w.j))
}
func (w *W) PrintAlignInfo() {
	fmt.Printf("alignof W=%d\n", unsafe.Alignof(*w))
	fmt.Printf("alignof(w.b)=%d\n", unsafe.Alignof(w.b))
	fmt.Printf("alignof(w.i)=%d\n", unsafe.Alignof(w.i))
	fmt.Printf("alignof(w.j)=%d\n", unsafe.Alignof(w.j))
}

func init() {
	var w *W = new(W)
	w.PrintSizeInfo()
	w.PrintAlignInfo()
}
